Execution control: EN, ENO
Use the input EN
and the output ENO
of a →block to control the execution of this block and of following blocks.
In this article: |
---|
Blocks with EN/ENO
All blocks provide input EN
and output ENO
when →calling the block. Those blocks are:
-
the standard blocks of Neuron Power Engineer, e.g. the standard blocks
-
your user blocks
Mind that a formal call must be used when you want to address the EN
/ENO
. In detail:
-
If you want to set
EN
for a block resp. if you want to accessENO
of a block, you must use the formal call for this block.
An assignment to inputEN
of the block resp. an access to outputENO
of the block is only allowed within the formal call of the block. -
If you do not need to control the execution, you can use either a formal (without
EN
/ENO
) or a non-formal call of the block.
The FAQ article "When to use a formal call? When to use a non-formal call?" contains more information on formal and non-formal call.
Behavior of EN
This behavior applies to standard blocks as well as to user blocks. See "Examples for behavior of EN and ENO" for illustrations of the behavior.
If the value of EN is set to this value, |
the following behavior is valid when calling the block: |
---|---|
( |
|
Applies to the FBD-editor: The value |
|
Conclusion: When to use EN with blocks?
-
If you want to clear the execution of a block, set
EN
toTRUE
within the call of the block. -
If you want to suppress the execution of a block, set
EN
toFALSE
within the call of the block.
Avoid the following constructs:
-
Several blocks assign a value to the same variable.
-
The value
FALSE
is assigned to the inputEN
of one of these blocks. -
The blocks and the variable are located within the same network. Mind that connectors and continuations are elements of the networks – although there is no graphical connection.
If you are creating such constructs anyway, the assignment to the variable will not be executed. Moreover, if assignments depend on this variable, the behavior of these assignments becomes difficult to reproduce.
Behavior of ENO
This behavior applies to standard blocks as well as to user blocks.
-
If the block is executed correctly, output
ENO
follows inputEN
(see table under "Behavior of EN"). -
If an error is detected while executing a block with internal error diagnostic, output
ENO
of this block is set to valueFALSE
(or an equivalent). The values for all other outputs and in-out variables of the block are in principle undefined. That means that these variables can assume different values on different target systems. -
This applies only to the PLCopen blocks: The output
ENO
of the PLCopen block is set to valueFALSE
(or an equivalent), if this block unconditionally reaches an undefined diagnostic code.
Conclusion: When to use ENO with blocks providing an internal error diagnostic?
If you want to clear the execution of following blocks but only when the current block is executed without errors, then make the execution of the following blocks dependent on output ENO
of the current block (e.g. by an appropriate access to output ENO
in the formal call). Condition: The current block must provide an internal error diagnostic.
Blocks with internal error diagnostic
The following standard blocks are providing an internal error diagnostic:
ECM_ACONTIS_CONFIGURED_SLAVES block
ECM_ACONTIS_CONNECTED_SLAVES block
MB_WriteAndReadRegisters block
SAVE_ALL_NAMED_MEMORY_RETAIN block
SAVE_NAMED_MEMORY_RETAIN block
If you want to create a user block with an internal error diagnostic, you must create one or several assignments to ENO
in your user block.
Examples for behavior of EN and ENO
Examples: Execution when EN=TRUE
FBD-logic with a function block instance |
---|
Note: The values are displayed by using →OLT-fields. |
Explanation of the execution: As input |
Equivalence as ST-code |
---|
|
There is the same execution for a function. To illustrate this, here just the FBD-logic:
The execution is analogous to the one of the RS
block: As input EN
for ADD
is set to value TRUE
, output ENO
is set to the value TRUE
and the functionality of the ADD
block is executed. Hence, the value 5
is assigned to the variables result1
and result2
. As the assignments are executed, the variables Var7
and Var8
are also set to TRUE
as well as the variables result3
and result4
are also set to value 5
.
Examples: Execution when EN=FALSE
FBD-logic with a function block instance |
---|
|
Explanation of the execution: As input |
Equivalence as ST-code |
---|
|
There is the same execution for a function. To illustrate this, here just the FBD-logic with the default behavior:
Again, the execution is analogous to the one of the RS
block: As input EN
for the call of ADD
is now set to value FALSE
, output ENO
is set to the value FALSE
and the functionality of the ADD
block is not executed any longer. Due to EN=FALSE
, the assignments from the output variables of the ADD
block are not executed because they are located within the same network. The evidence for this is the assignment of output ENO
of the ADD
block to Var7
: The value FALSE
of output ENO
is not assigned to the variable Var7
– so the last value TRUE
is retained for Var7
.
Note: As difference to a function block instance, the last return value of the function is not retained. Instead the return value of ADD
is now 0
, because it has been type-coded with the data type INT
and 0
is the initial value of INT
. The assignments from the return value are not executed as well (see the next examples for more explanations).
If the return value of ADD
is 5 in your Neuron Power Engineer version, you are using a configuration where the variables and a return value of functions retain the last values assigned to them. And value 5
is the value that has been calculated at last.
In order to illustrate in detail that assignment from output variables are not executed due to EN=FALSE
, the following values have been changed in the Values of Variables view:
-
The value for
Q1
of the function block instanceRSa1
has been changed fromTRUE
toFALSE
.
Explanation of the execution: Although the value forQ1
of theRS
block is now set to valueFALSE
, the variablesVar2a
andVar3a
still have the valueTRUE
. Reason: Due toEN=FALSE
of theRS
block, the assignments from output variables are not executed because they are located within the same network. Mind that connectors and continuations are elements of the networks – although there is no graphical connection.
Note: The following assignment from variableVar2a
toVar5a
and the one fromVar3a
toVar6a
are executed again. This would become visible, if the values forVar2a
andVar3a
would be changed e.g. within the Values of Variables view. -
The value of the variable
add1
(that is used as input for theADD
block) has been changed from2
to12
.
Again, the execution is analogous to the one of theRS
block: Althoughadd1
is now set to value12
, the variablesresult1
andresult2
still have the value5
. Reason: Due toEN=FALSE
of theADD
block, the assignments of the return value are not executed because they are located within the same network. Mind that connectors and continuations are elements of the networks – although there is no graphical connection.
Note: The following assignment from variableresult1
toresult3
and the one fromresult2
toresult4
are executed again. This would become visible, if the values forresult1
andresult2
would be changed e.g. within the Values of Variables view.
Examples: Forcing the assignments when EN=FALSE
In case of a block with EN=FALSE
, you are able to force the assignments from the output variables anyway. Mind that the the corresponding example under "Examples: Execution when EN=FALSE" is the basis for the following illustrations.
If the block is a function block instance, there are 2 workarounds within the FBD-editor:
1st workaround: Create the assignment in a different network (by entering the output variable within a value field). |
|
2st workaround: Use the call of the |
|
Due to EN=FALSE
for the function block instances RS1b
and RS1c
, their output ENO
is set to value FALSE
. The value for Q1
of the corresponding function block instances has also been changed to FALSE
– as seen in the previous examples. But in contrast to the previous examples, the assignments from the output variables are now executed because they are located within a different network (1st workaround) or they have been realized by using the MOVE
block within the same network (2nd workaround).
It is not possible to enter output variables of functions within a value field. Reason: According to the IEC-standard, function do not store their state. Hence, there is only the following workaround for functions:
Workaround: Use the call of the |
|
Due to EN=FALSE
for ADD
, the output ENO
is set to value FALSE
. The value for add1
has been changed to 12
– as seen in the previous examples. But in contrast to the previous examples, the assignments from the return value are now executed because they have been realized by using the MOVE
block within the same network. Mind that the variables result5
and result6
now have the value 0
. Reason: The return value of ADD
has been type-coded with the data type INT
and 0
is the initial value of INT
.
If the block is a function block instance, there is the following workaround within the ST-editor:
Workaround: Use accesses to the corresponding variables that are to be entered separately from the call. |
|
Due to EN=FALSE
for RS1a
and RS1b
, their output ENO
is set to value FALSE
. The value for Q1
of the corresponding function block instances has been changed to FALSE
– as done in the previous examples. But in contrast to RS1a
, the assignments from the output variables of RS1b
are executed because they are entered separately from the call.
If the block is a function, there is no workaround within the ST-editor. Reason: Function do not store their state. Subsquently, it is not possible to enter the output variables and the return value of the function separately from the call of the function.